<?php

namespace JSSDK\Model;


/**
 * YFAccessToken 信息
 *
 * Class YFAccessToken
 * @package JSSDK\Model
 */
class YFAccessToken
{
    /**
     * YFAccessToken constructor.
     *
     * @param array $access_token
     */
    public function __construct($access_token)
    {
        $_SESSION['JSSDK_YF_ACCESS_TOKEN'] = $access_token;
        self::$access_token = $access_token;
    }

    public static function getAccessToken()
    {
        if($_SESSION['JSSDK_YF_ACCESS_TOKEN']){
            self::$access_token = $_SESSION['JSSDK_YF_ACCESS_TOKEN'];
        }
        return self::$access_token;
    }

    public static function setAccessToken($access_token)
    {
        $_SESSION['JSSDK_YF_ACCESS_TOKEN'] = $access_token;
        self::$access_token = $_SESSION['JSSDK_YF_USERINFO'];
    }

    /**
     * $access_token 的创建事件
     *
     * @var array
     */
    private static $access_token;

}